/* eslint-disable no-console */

import { includes } from 'lodash';

const VITE_LOGGER_LEVEL = import.meta.env.VITE_LOGGER_LEVEL || '';

const levels = VITE_LOGGER_LEVEL.split(',');

const debug = (content, type = '', color = 'teal') => {
    if (!includes(levels, 'debug')) return;
    console.log(`%c---------------->${type}`, `color:${color};font-weight:bolder;`);
    console.log(content);
    console.log('%c<----------------', `color:${color};font-weight:bolder;`);
};

const info = (content, type = '', color = 'green') => {
    if (!includes(levels, 'info')) return;
    console.log(`%c---------------->${type}`, `color:${color};font-weight:bolder;`);
    console.log(content);
    console.log('%c<----------------', `color:${color};font-weight:bolder;`);
};

const error = (content, type = '', color = 'red') => {
    if (!includes(levels, 'error')) return;
    console.log(`%c---------------->${type}`, `color:${color};font-weight:bolder;`);
    console.log(content);
    console.log('%c<----------------', `color:${color};font-weight:bolder;`);
};

export default {
    debug,
    log: debug,
    info,
    error,
};
